package game.ui.hud
{
	import engine.asset.*;
	import flash.display.*;
	import flash.text.*;
	import game.ui.controls.*;
	import game.ui.core.*;
	import game.ui.data.*;
	import game.ui.events.*;
	import game.ui.layouts.*;
	
	public class RxLevelSelect extends RxUIElement
	{
		private var m_asset:RxAssetSWF;
		private var m_callback:Function;
		private var m_levelGrid:RxDataGrid;
		private var m_labelData:RxArrayCollection;
		private var m_scrollBar:RxScrollBar;
		private var m_titleLabel:TextField;
		
		public function RxLevelSelect(param1:Stage, param2:Function)
		{
			this.m_callback = param2;
			var _loc_3:* = new Array();
			var _loc_4:* = RxAssetCSV.GetByURL("levels.csv");
			var _loc_5:int = 1;
			while (_loc_5 < _loc_4.rows)
			{
				
				_loc_3.push({mapName:_loc_4.GetColString("identifier", _loc_5), label:_loc_4.GetColString("dispName", _loc_5)});
				_loc_5++;
			}
			this.m_labelData = new RxArrayCollection(_loc_3);
			var _loc_6:* = new TextFormat();
			new TextFormat().size = 54;
			_loc_6.font = "Arial";
			_loc_6.align = TextFormatAlign.CENTER;
			this.m_titleLabel = new TextField();
			this.m_titleLabel.defaultTextFormat = _loc_6;
			this.m_titleLabel.text = "Select Level";
			this.m_titleLabel.x = 0;
			this.m_titleLabel.y = 5;
			this.m_titleLabel.width = 700;
			this.m_titleLabel.mouseEnabled = false;
			addChild(this.m_titleLabel);
			graphics.clear();
			graphics.lineStyle(1, 16777215);
			graphics.beginFill(13421772);
			graphics.drawRoundRect(0, 0, 800, 450, 20, 20);
			graphics.endFill();
			var _loc_7:* = new RxButtonBase("", RxButtonModeConstants.NORMAL);
			new RxButtonBase("", RxButtonModeConstants.NORMAL).SetIconUrl("ui/hud/wireframe/down_scroll_arrow.png");
			_loc_7.SetDrawsBackground(false);
			var _loc_8:* = new RxButtonBase("", RxButtonModeConstants.NORMAL);
			new RxButtonBase("", RxButtonModeConstants.NORMAL).SetIconUrl("ui/hud/wireframe/up_scroll_arrow.png");
			_loc_8.SetDrawsBackground(false);
			var _loc_9:* = new RxButtonBase("", RxButtonModeConstants.NORMAL);
			new RxButtonBase("", RxButtonModeConstants.NORMAL).SetIconUrl("ui/hud/wireframe/scroll_thumb.png");
			_loc_9.SetDrawsBackground(false);
			this.m_scrollBar = new RxScrollBar(true, 50, false, _loc_8, _loc_7, _loc_9);
			this.m_scrollBar.x = 710;
			this.m_scrollBar.y = 60;
			addChild(this.m_scrollBar);
			//var _loc_10:* = new RxVerticalGridLayout(5, 7, 130, 40, 10, 10, true);
			//this.m_levelGrid = new RxDataGrid(this.m_labelData, _loc_10, RxButtonBase);
			this.m_levelGrid.x = 3;
			this.m_levelGrid.y = 70;
			//this.m_levelGrid.SetScrollBarComponent(this.m_scrollBar, false);
			//this.m_levelGrid.addEventListener(RxDataGridEvent.CHILD_CLICKED, this.OnLevelSelectButton);
			addChild(this.m_levelGrid);
			//this.m_scrollBar.height = this.m_levelGrid.GetLayout().visibleHeight;
			x = (param1.stageWidth - width) * 0.5;
			y = (param1.stageHeight - height) * 0.5;
		}
	}
}